package com.chinaums.fsp.sdk.request;

import java.io.File;

import com.chinaums.fsp.base.pgt.TransType;
import com.chinaums.fsp.sdk.base.RequestData;
import com.chinaums.fsp.sdk.base.ResponseDataWrapper;
import com.chinaums.fsp.sdk.pgt.params.OrganizationRegRequest;
import com.chinaums.fsp.sdk.pgt.params.OrganizationRegResponse; 
/**
 * 机构开户
 * @author hhh
 */
public class OrganizationRegTest extends BaseRequest{
	
	/**
	 * 机构时，请到BaseRequest 切换URL
	 * 
	 */

	/* 测试注册买家 */
//	public void testRegBuyerRequest() throws Exception {
//		
//		PgtRequestFactory rf = FACTORY.factory();
//		
//		RequestData.Builder builder = this.createRequestDataBuilder();
//		builder.setTransType(TransType.ORGANIZATION_REGISTER.getTransCode());
//		
//		OrganizationRegRequest data = OrganizationRegRequest.newBuilder()
//																		// 测试环境中，银行账号请勿以1和2结尾，否则实名认证会失败
//																		.setAccountNo("803411000000014")
//																		.setOrgName("票管通子机构052303-买家")
//																		.setSettleId("305521005074")
//																		.setRoleType(1)
//																		.setEmail("105410555@qq.com")
//																		.setLegalName("买家法人052303")
//																		.setLegalIdcard("511423198612160018")
//																		.setLegalMobile("15159552255")
//																		.setBusinessContactName("买家联系人052303")
//																		.setBusinessContactIdcard("511423198612160012")
//																		.setBusinessContactMobile("15159552255")
//																		.setBusinessLicenseNo("511423933801860812")
//																		.setAddress("福建省泉州市丰泽区东海大街")
//																		.setSpecifiedAccountNo("695603264910011")
//																		.build()
//																		;
//		rf.transType(TransType.ORGANIZATION_REGISTER.getTransCode())
//		.responseClass(OrganizationRegResponse.class)
//		.data(data)
//		;
//		
//		File file = new File(OrganizationRegTest.class.getClassLoader().getResource("org_cert.zip").getPath());
//		ResponseDataWrapper rdw = rf.post(file);
//	
//		this.print(rdw);
//	}
	
	/* 测试注册卖家 */
	public void testRegSellerRequest() throws Exception {
		
		PgtRequestFactory rf = FACTORY.factory();
		
		RequestData.Builder builder = this.createRequestDataBuilder();
		builder.setTransType(TransType.ORGANIZATION_REGISTER.getTransCode());
		
		OrganizationRegRequest data = OrganizationRegRequest.newBuilder()
																		// 测试环境中，银行账号请勿以1和2结尾，否则实名认证会失败
																		.setAccountNo("80571655333888259")
																		.setOrgName("测试机构5214")
																		.setSettleId("307393026091")
																		.setRoleType(2)
																		.setEmail("137628529@qq.com")
																		.setLegalName("卖家法人052303")
																		.setLegalIdcard("350583199401298311")
																		.setLegalMobile("18550002900")
																		.setBusinessContactName("卖家联系人hty")
																		.setBusinessContactIdcard("350583199401298311")
																		.setBusinessContactMobile("15019200112")
																		.setBusinessLicenseNo("521302023015465210")
																		.setAddress("福建省泉州市丰泽区津淮街迎津社区")
//																		.setSpecifiedAccountNo("695603264000111")
																		.build()
																		;
		rf.transType(TransType.ORGANIZATION_REGISTER.getTransCode())
		.responseClass(OrganizationRegResponse.class)
		.data(data)
		;
		File file = new File(OrganizationRegTest.class.getClassLoader().getResource("org_cert.zip").getPath());
		ResponseDataWrapper rdw = rf.post(file);
	
		this.print(rdw);
	}
	
}